<%@ page language="java"
	import="java.util.*,com.tjsinfo.tjsoa.worksummary.vo.*,com.tjsinfo.tjsoa.common.PaginationSupport"
	pageEncoding="UTF-8"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="com.tjsinfo.tjsoa.worksummary.vo.WorkSummaryMain"%>
<%@page
	import="com.tjsinfo.tjsoa.worksummary.vo.WorkSummaryExamine"%>
<%@page import="com.tjsinfo.tjsoa.system.vo.*"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
	+ request.getServerName() + ":" + request.getServerPort()
	+ path + "/";
	PaginationSupport paginationSupport=(PaginationSupport) session.getAttribute("mainList");
	List<WorkSummaryMain> infos = paginationSupport.getItems();
	PaginationSupport paginationSupport2=(PaginationSupport) session.getAttribute("examMainlist");	
	List<WorkSummaryExamine> infos2 = paginationSupport2.getItems();

	//总结页面的翻页用变量
	String pageNoStr = request.getParameter("pageNo");
	
	if (pageNoStr == null)
		pageNoStr = "0";
	Integer pageNo = Integer.valueOf(pageNoStr);
	//批示页面的翻页用变量
	String pageNoStr2 = request.getParameter("pageNo2");
	
	if (pageNoStr2 == null)
		pageNoStr2 = "0";
	Integer pageNo2 = Integer.valueOf(pageNoStr2);
	String temp=request.getParameter("temp");
	if(temp==null)temp="1";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<html:base />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>粮油集团办公自动化协作平台</title>
<style>
#container {
		    width:600px;
		    height:300px;
		    border:3px solid #c3daf9;
		}
		
.calendar {
    background-image:url(<%=basePath%>images/icon_64.gif) !important;
}

.blist {
    background-image: url(<%=basePath%>images/icon_64.gif) !important;
}

.bmenu {
    background-image: url(<%=basePath%>images/ju.gif) !important;
}

.menu-title{
    background: #ebeadb url(<%=basePath%>images/icon_64.gif) repeat-x;
    border-bottom:1px solid #99bbe8;
    color:#15428b;
    font:bold 10px tahoma,arial,verdana,sans-serif;
    display:block;
    padding:3px;
}
.lan01{
background: url(<%=basePath%>images/lanbg01.gif) no-repeat 0 0; width:6px; height:24px;} 
.lan02{
background: url(<%=basePath%>images/lanbg02.gif) repeat-x; width:99%; height:24px;}            
.lan03{
background: url(<%=basePath%>images/lanbg03.gif) no-repeat; width:8px; height:24px;}             
.cha{
padding-top:3px}           
</style> 
		<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" />
			<link rel="stylesheet" type="text/css" href="<%=basePath %>ajaxFramework/ext-2.1/resources/css/ext-all.css" />
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/common/global/pageControl.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/common/system/selectusercheck.js"></script>
	<script type="text/javascript" src="<%=basePath%>FCKeditor/fckeditor.js"></script>
		<script type="text/javascript">
 		function summaryMain()
 		{
 			var list = document.getElementById('summary');
 			list.className = 'over';
 			var list2 = document.getElementById('examine');
 			list2.className = '';
 			var todaydiv = document.getElementById('summaryMain').style.display = "block" ;
 			var tomorrowdiv = document.getElementById('examineMain').style.display = "none" ;
 		}
 		function examineMain()
 		{
 			var list = document.getElementById('examine');
 			list.className='over';
 			var list2 = document.getElementById('summary');
 			list2.className = '';
 			var todaydiv = document.getElementById('summaryMain').style.display = "none" ;
 			var tomorrowdiv = document.getElementById('examineMain').style.display = "block" ;
 		}
 		function submitpages(value){
			if(value==-1){
				alert("请重新选择页码!");
				return ;
			}
			window.location.href='<%=basePath%>tjsinfo/tjsoa/worksummary/workSummaryList.do?pageNo='+value+'&pageNo2=<%=pageNo2%>&temp=1';
		}
		function submitpages2(value2){
			if(value2==-1){
				alert("请重新选择页码!");
				return ;
			}
			window.location.href='<%=basePath%>tjsinfo/tjsoa/worksummary/workSummaryList.do?pageNo2='+value2+'&pageNo=<%=pageNo%>&temp=2';
		}
		function deletefrom(id)
	    {
	      
	       document.form1.id.value = id;
		   document.getElementById('summaryMain').style.display = "block";
		   document.getElementById('deletefrom').style.top =  document.body.clientHeight/2;
		   document.getElementById('deletefrom').style.left = document.body.clientWidth/5;
		   document.getElementById('deletefrom').style.display = "block";
	    }
		function deleteWorkSummary()
	    {
		   var form1 =  document.getElementById('form1');
		   form1.setAttribute('action','<%=basePath%>tjsinfo/tjsoa/worksummary/deleteWorksummary.do');
		   document.form1.submit();
	    }
	    function qxdeletefrom()
	{
		document.getElementById('summaryMain').style.display = "block";
		document.getElementById('deletefrom').style.display = "none";
	}
	</script>
	</head>
	<body>
		<div id="right">
		<div style="height:92%;overflow-y:scroll">
			<div class="p_011">
				<ul>
					<li class="s02">
						<a
							href="<%=basePath%>tjsinfo/tjsoa/worksummary/createWorksummary.do">新建工作总结</a>
					</li>
				</ul>
			</div>
	
			<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
				<tr>
					<td width="100%" valign="top" height="100%">
						<div class="contabwd">
							<div id="index_title">
								<ul>
									<li<%if(temp.equals("1"))out.print(" class=\"over\""); %> id="summary">
										<a href="javascript:summaryMain()"><span>我的工作总结</span>
										</a>
									</li>
									<li<%if(temp.equals("2"))out.print(" class=\"over\""); %> id="examine">
										<a href="javascript:examineMain()"><span>工作总结批示</span>
										</a>
									</li>
								</ul>
							</div>
	<form name="form1" method="post" id="form1">
							<div class="gzzjtab" id="summaryMain" <%if(temp.equals("2")){%>style="display: none"<%} %>>
								<table class="p_06" width="100%" border="0" cellspacing="0">
									<tr>
										<th width="12%" style="text-align: center">
											日期
										</th>
										<th width="60%" style="text-align: center">
											标题
										</th>
										<th width="8%" style="text-align: center">
											撰写人

										</th>
										<th width="10%" style="text-align: center">
											状态

										</th>
										<th width="10%" style="text-align: center">
											操作
										</th>
									</tr>
									<%
										int a = 1;
																SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
																	for (Iterator iterator = infos.iterator(); iterator.hasNext();) {
																		WorkSummaryMain wsm = (WorkSummaryMain) iterator.next();
																		if(a % 2 == 0){
									%>
									<tr bgcolor="#F4F4F4">
										<td ><%=wsm.getTimes()%></td>
										<td >
											<a href="<%=basePath%>tjsinfo/tjsoa/worksummary/openWorksummary.do?&id=<%=wsm.getId()%>"><%=wsm.getSubject()%></a>
										</td>
										<td>
											<%=wsm.getTjsUser().getUserName()%>
										</td>
										<%
											if(!wsm.getExamineState().equals("1"))
																					{
										%>
										<td>
											未审阅

										</td>
										<td>
											<a
												href="<%=basePath%>tjsinfo/tjsoa/worksummary/updateWorksummary.do?&id=<%=wsm.getId()%>">修改</a>
											|
													<a href="javascript:deletefrom('<%=wsm.getId()%>')">删除</a>
												
										</td>
										<%
											}else{
										%>
										<td>
											已审阅

										</td>
										<td>
											<a
												href="<%=basePath%>tjsinfo/tjsoa/worksummary/openExamine.do?&id=<%=wsm.getId()%>">查看意见</a>
										</td>
									</tr>
									<%
										}
													     }else{
									%>
						           <tr>
										<td><%=wsm.getTimes()%></td>
										<td>
											<a href="<%=basePath%>tjsinfo/tjsoa/worksummary/openWorksummary.do?&id=<%=wsm.getId()%>"><%=wsm.getSubject()%></a>
										</td>
										<td>
											<%=wsm.getTjsUser().getUserName()%>
										</td>
										<%
											if(!wsm.getExamineState().equals("1"))
																					{
										%>
										<td>
											未审阅

										</td>
										<td>
											<a
												href="<%=basePath%>tjsinfo/tjsoa/worksummary/updateWorksummary.do?&id=<%=wsm.getId()%>">修改</a>
											|
											<a href="javascript:deletefrom('<%=wsm.getId()%>')">删除</a>
											
										</td>
										<%
											}else{
										%>
										<td>
											已审阅

										</td>
										<td>
											<a
												href="<%=basePath%>tjsinfo/tjsoa/worksummary/openExamine.do?&id=<%=wsm.getId()%>">查看意见</a>
										</td>
									</tr>
						     <%
						     	}
						     				   }
						     				   a++;
						     				   }
						     %>
									<tr align="center">
										<td colspan="5" style="border-bottom: 1px #d0d0d0 solid">
											<div class="page01">
												共<%=paginationSupport.getTotalCount()%>条,共<%=paginationSupport.getPageCount()%>页&nbsp;&nbsp;
												当前为第<%=pageNo + 1%>页&nbsp;&nbsp;

												<%
													if (paginationSupport.getStartIndex() > 1) {
												%>
												<a
													href="<%=basePath%>tjsinfo/tjsoa/worksummary/workSummaryList.do?pageNo=<%=pageNo - 1%>&pageNo2=<%=pageNo2%>&temp=1">上一页</a>
												<%
													}
												%>

												<%
													if (paginationSupport.getStartIndex() + paginationSupport.getPageSize() < paginationSupport .getTotalCount()) {
												%>
												<a
													href="<%=basePath%>tjsinfo/tjsoa/worksummary/workSummaryList.do?pageNo=<%=pageNo + 1%>&pageNo2=<%=pageNo2%>&temp=1">下一页</a>
												<%
													}
												%>

												&nbsp;&nbsp; 跳转到

												<select name="selectPage" id="selectPage"
													onchange="submitpages(this.value)">
													<option value="0">
														--跳转--
													</option>
													<%
														for (int pi = 0; pi < paginationSupport.getPageCount(); pi++) {
													%>
													<option value="<%=pi%>"><%=pi + 1%></option>
													<%
														}
													%>
												</select>
												页

											</div>
										</td>
									</tr>
								</table>
							</div>
		<div style="display: none;text-align:center" class="contact_content" id="deletefrom">
             <table width="478" border="0" cellpadding="0" cellspacing="0" >
               <tr>
                 <td>
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td class="lan01">&nbsp;</td>
                        <td class="lan02">
                          <table width="99%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="5%" align="center" style="padding-top:3px;"><img src="<%=basePath%>images/m_icon051.gif" /></td>
                                <td width="89%" align="left" style="color:#FFFFFF; font-weight:bold;padding-top:3px;">编辑</td>
                                <td width="6%"><div class="cha"><a href="javascript:qxdeletefrom()"><img src="<%=basePath%>images/cha.gif" /></a></div></td>
                              </tr>
                           </table>
                        </td>
                        <td class="lan03">&nbsp;</td>
                      </tr>
                  </table>
                 </td>
               </tr>
               <tr>
                 <td height="109" class="zz">
                     <table width="90%" height="80%" border="0" cellspacing="0" cellpadding="0" class="researchtab">
                      <tr>
                        <td width="17%" align="center"><img src="<%=basePath%>images/bjicon.jpg" /></td>
                        <td width="83%" align="left">是否要删除您选择的总结,请确认?</td>
                      </tr>
                      <tr>
                        <td align="center" colspan="2" style="border-top:1px #CFCFD1 solid"><a href="javascript:deleteWorkSummary()" ><img src="<%=basePath%>images/qd.gif" />&nbsp;<a href="javascript:qxdeletefrom()" ><img src="<%=basePath%>images/qx.gif" /></a>
                        </td>
                       </tr>
                    </table>
                 </td>
               </tr>
             </table>
            </div>
        <input  type="hidden" name="id" value=""/>
    </form>
							<div class="gzpstab" id="examineMain" <%if(temp.equals("1")){%>style="display: none"<%} %>>
								<table class="p_06" width="100%" border="0" cellspacing="0">
									<tr>
										<th width="14%">
											日期
										</th>
										<th width="60%">
											标题
										</th>
										<th width="10%">
											撰写人

										</th>
										<th width="10%">
											操作
										</th>
									</tr>
									<%
										int b=1;
																	for (Iterator iterator = infos2.iterator(); iterator.hasNext();) {
																		WorkSummaryMain wsm = (WorkSummaryMain) iterator.next();
																		if(b % 2 == 0){
									%>
									<tr bgcolor="#F4F4F4">
										<td><%=wsm.getTimes()%></td>
										<td>
											<%if(!wsm.getExamineState().equals("1")){
										      %>
											<a href="<%=basePath%>tjsinfo/tjsoa/worksummary/openWorksummary.do?&id=<%=wsm.getId()%>&start=1"><%=wsm.getSubject()%></a>
											<%}else{ %>
											<a href="<%=basePath%>tjsinfo/tjsoa/worksummary/openWorksummary.do?&id=<%=wsm.getId()%>&start=1"><font color="red"><%=wsm.getSubject()%></font></a>
											<%} %>
										</td>
										<td>
											<%=wsm.getTjsUser().getUserName()%>
										</td>
										<td>
											<a href="<%=basePath%>tjsinfo/tjsoa/worksummary/writeWorksummary.do?&id=<%=wsm.getId()%>&start=1">批示意见</a>
										</td>
									</tr>
									<%   
						     }else{%>
						           <tr>
										<td><%=wsm.getTimes()%></td>
										<td>
											<%if(!wsm.getExamineState().equals("1")){
										      %>
											<a href="<%=basePath%>tjsinfo/tjsoa/worksummary/openWorksummary.do?&id=<%=wsm.getId()%>&start=1"><%=wsm.getSubject()%></a>
											<%}else{ %>
											<a href="<%=basePath%>tjsinfo/tjsoa/worksummary/openWorksummary.do?&id=<%=wsm.getId()%>&start=1"><font color="red"><%=wsm.getSubject()%></font></a>
											<%} %>
										</td>
										<td>
											<%=wsm.getTjsUser().getUserName()%>
										</td>
										<td>
											<a href="<%=basePath%>tjsinfo/tjsoa/worksummary/writeWorksummary.do?&id=<%=wsm.getId()%>&start=1">批示意见</a>	
										</td>
									</tr>
									<%
									}
						   b++;
						    }
						%>
									<tr align="center">
										<td colspan="5" style="border-bottom: 1px #d0d0d0 solid">
											<div class="page01">
												共<%=paginationSupport2.getTotalCount()%>条,共<%=paginationSupport2.getPageCount()%>页&nbsp;&nbsp;
												当前为第<%=pageNo2 + 1%>页&nbsp;&nbsp;
												<%
														if (paginationSupport2.getStartIndex() > 1) {
													%>
												<a
													href="<%=basePath%>tjsinfo/tjsoa/worksummary/workSummaryList.do?pageNo2=<%=pageNo2 - 1%>&pageNo=<%=pageNo%>&temp=2">上一页</a>
												<%
														}
													%>

												<% if (paginationSupport2.getStartIndex() + paginationSupport2.getPageSize() < paginationSupport2 .getTotalCount()) {
													%>
												<a
													href="<%=basePath%>tjsinfo/tjsoa/worksummary/workSummaryList.do?pageNo2=<%=pageNo2 + 1%>&pageNo=<%=pageNo%>&temp=2">下一页</a>
												<%
														}
													%>

												&nbsp;&nbsp; 跳转到

												<select name="selectPage" id="selectPage"
													onchange="submitpages2(this.value)">
													<option value="0">
														--跳 转--
													</option>
													<%
															for (int pi = 0; pi < paginationSupport2.getPageCount(); pi++) {
														%>
													<option value="<%=pi%>"><%=pi + 1%></option>
													<%
															}
														%>
												</select>
												页

											</div>
										</td>
									</tr>
								</table>
							</div>
						</div>
					</td>
				</tr>
			</table></div>
		</div>
	</body>
</html>
